package org.tulip;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
// Activity之间的跳转如何控制?
public class HelloandroidActivity extends Activity {
    /** Called when the activity is first created. */
	
	final static String Logo="EverNoteX";
	private Button buttonA, buttonB ;
	private EditText editText1 ;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 这个Activity的配置放在main.xml文件中?
        setContentView(R.layout.main);
        
        // 这两个变量获得实例，只能在onCreate中进行，在类实例初始化里进行，编译不会出错，但是运行会出错
        // 获得实例还必须在 设置ContentView之后才可以进行
        buttonA = (Button) findViewById(R.id.buttonA);
        buttonB = (Button) findViewById(R.id.buttonB);
        editText1 = (EditText) findViewById(R.id.editText1);
        
        buttonA.setOnClickListener( new OnClickListener() {
        	int countA=0;
			public void onClick(View v) {
				// TODO Auto-generated method stub
				editText1.setText("ButtonA clicked:)");
				Log.d(Logo, "logx A Button clicked" + countA ++);
			}
		}
        		);
        
        buttonB.setOnClickListener(new OnClickListener() {
			int countB=0;
			public void onClick(View v) {
				// TODO Auto-generated method stub
				editText1.setText("ButtonB clicked:)");
				Log.d(Logo, "logx Button B clicked" + countB ++);
			}
		});
        
        
//    	
        Log.d(Logo, "logx onCreat Method is executed, haha1");
    }
    
    // 加这个标注有什么作用呢?
    @Override
    protected void onStart() {
    	super.onStart();
    	// 在原来方法执行之后，额外增加输出
    	Log.d(Logo, "logx onStart Method is executed, haha1");
    }
    
    protected void onRestar() {
    	super.onRestart();
    	Log.d(Logo, "logx onRestart Method is executed, haha1");
    }
    
    protected void onResume() {
    	super.onResume();
    	Log.d(Logo, "logx onResume is executed, haha1");
    }
    
    protected void onDestroy() {
    	super.onDestroy();
    	Log.d(Logo, "logx onDestroy is executed, haha1");
    }
    
    protected void onPause() {
    	super.onPause();
    	Log.d(Logo, "logx onPause is executed, haha1");
    }
}